﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace SYH.Public.DAL
{
    public class PublicImageData
    {
        #region 返回DataId的图片
        /// <summary>
        /// 返回DataId的图片
        /// </summary>
        /// <param name="dataId"></param>
        /// <param name="dataType"></param>
        /// <returns></returns>
        public DataTable GetUserImgList(int dataId, int dataType)
        {
            SqlParameter[] par = new SqlParameter[] { 
                new SqlParameter("@DataId",dataId),
                new SqlParameter("@DataType",dataType)
            };
            return Common.SqlHelper.ExecuteDataset(Config.WebConfig.SqlConnString, CommandType.StoredProcedure, "Public_ImageData_GetDataImgList", par).Tables[0];
        }
        #endregion

        #region 根据Id删除图片
        /// <summary>
        /// 根据Id删除图片
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool Delete(int Id)
        {
            SqlParameter[] par = new SqlParameter[] { 
                new SqlParameter("@Id",Id)
            };
            return Common.SqlHelper.ExecuteNonQuery(Config.WebConfig.SqlConnString, CommandType.StoredProcedure, "Public_ImageData_Delete", par) > 0;
        }
        #endregion
    }
}
